<%@page language="java"%>
<%@page contentType="text/html"%>
<%@page import="java.util.*, descriptor.*"%>

<jsp:include page="admin_generic_pre.jsp" >
	<jsp:param name="pagesubtitle" value="Locations - Add a city" />
</jsp:include>

	<p>
		<jsp:useBean id="infos" class="java.lang.String" scope="request" />
		<%= infos %>
	</p>
	<p>
		<jsp:useBean id="city" class="descriptor.CityDescriptor" scope="request" />
		<jsp:useBean id="countries" class="descriptor.CountriesListDescriptor" scope="request" />
		<form method="POST" action="admin">
			<table>
				<tr><td>Name: </td><td><input type="text" name="name" value="<%=city.getName()%>" /></td></tr>
				<tr>
					<td>Country:</td>
					<td>
						<select name="countryId">
						<%for (CountryDescriptor country: countries.getCountryDescriptors()){%>
							<option value="<%= country.getID()%>" <% if (country.getID() == city.getCountryId()){ %> selected="selected" <%}%> >
								<%= country.getName() %>
							</option>
						<%}%>
						</select>
					</td>
				</tr>
			</table>
			<input type="hidden" name="cityId" value="<%=city.getID()%>" />
			<input type="hidden" name="action" value="locations_createupdatecity" />
			<input type="submit" name="button_createupdate" value="Create/Update" />
		</form>
	</p>
	
	
<jsp:include page="admin_generic_post.jsp" ></jsp:include>

</html>